package cn.javass.dp.builder.example3;



import java.util.*;

/**
 * 不使用模式的解决方案
 */
public class Client {
    public static void main(String[] args) {
        ExportHeaderModel ehm = new ExportHeaderModel();
        ehm.setDepId("一分公司");
        ehm.setExportDate("2019-11-11");

        Map<String, Collection<ExportDataModel>> mapData = new HashMap<>();

        ExportDataModel edm1 = new ExportDataModel();
        edm1.setProductId("编号001");
        edm1.setPrice(100);
        edm1.setAmount(80);

        ExportDataModel edm2 = new ExportDataModel();
        edm2.setProductId("编号002");
        edm2.setPrice(1001);
        edm2.setAmount(801);

        ExportDataModel edm3 = new ExportDataModel();
        edm3.setProductId("编号003");
        edm3.setPrice(10202);
        edm3.setAmount(8202);
        List<ExportDataModel> list  = new ArrayList<>();
        list.add(edm1);
        list.add(edm2);
        list.add(edm3);
        mapData.put("销售记录表",list);
        ExportFooterModel foot = new ExportFooterModel();
        foot.setExportUser("夏国杰");

        Builder builder = new XmlBuilder();
        Director director = new Director(builder);
        director.construct(ehm,mapData,foot);
        System.out.println(builder.getResult());
    }
}
